
# ifndef __DFX_RENDER_STATE_OGL_H__
# define __DFX_RENDER_STATE_OGL_H__

# include "dfxRenderState.h"
# include <GL/glew.h>
# include <GL/GL.h>

namespace DFX
{
    class GraphicsDevice_OGL;

    class AlphaState_OGL : public AlphaState
    {
    private:

        GraphicsDevice_OGL  *mGraphicsDevice;

    public:
        
        GLboolean           BlendEnabled;
        GLboolean           AlphaTestEnabled;
        GLenum              SrcBlend;
        GLenum              DestBlend;
        GLenum              AlphaFunction;
        GLenum              BlendEquation;
        GLfloat             Reference;
        GLfloat             ConstantColor[4];

    public:

        AlphaState_OGL(GraphicsDevice_OGL *gd, const AlphaStateDescription &desc);
        ~AlphaState_OGL();

        GraphicsDevice_OGL* GetGraphicsDevice() const
        {
            return mGraphicsDevice;
        }

        void Apply();
    };

    class RasterizerState_OGL : public RasterizerState
    {
    private:

        GraphicsDevice_OGL  *mGraphicsDevice;

    public:

        GLboolean           Enabled;
        GLenum              Face;
        GLenum              PolygonMode;

    public:

        RasterizerState_OGL(GraphicsDevice_OGL *gd, const RasterizerStateDescription &desc);
        ~RasterizerState_OGL();

        GraphicsDevice_OGL* GetGraphicsDevice() const
        {
            return mGraphicsDevice;
        }

        void Apply();
    };

    class DepthState_OGL : public DepthState
    {
    private:

        GraphicsDevice_OGL  *mGraphicsDevice;

    public:

        GLboolean           Enabled;
        GLboolean           Writable;
        GLboolean           CompareFunction;

    public:

        DepthState_OGL(GraphicsDevice_OGL *gd, const DepthStateDescription &desc);
        ~DepthState_OGL();

        GraphicsDevice_OGL* GetGraphicsDevice() const
        {
            return mGraphicsDevice;
        }

        void Apply();
    };

    class StencilState_OGL : public StencilState
    {
    private:

        GraphicsDevice_OGL  *mGraphicsDevice;

    public:

        GLboolean           Enabled;
        GLenum              Face;
        GLenum              CompareFunction;
        GLuint              Reference;
        GLuint              Mask;
        GLuint              WriteMask;
        GLenum              OnFail;
        GLenum              OnZFail;
        GLenum              OnZPass;

    public:

        StencilState_OGL(GraphicsDevice_OGL *gd, const StencilStateDescription &desc);
        ~StencilState_OGL();

        GraphicsDevice_OGL* GetGraphicsDevice() const
        {
            return mGraphicsDevice;
        }

        void Apply();
    };
}

# endif